<template>
   <div>
       <h2 v-text="msg" ref="title"></h2>
       <button @click="btn">点击显示上方的DOM元素</button>
       <School ref="sch" />
       <Student/>
   </div>
</template>

<script>
    // 引入组件
    import School from './components/School.vue'
    import Student from './components/Student.vue'

    export default {
        name:'App',
        // 注册
        data(){
            return{
            msg:'欢迎来到Vue'
            }
        },
        components:{
            School,
            Student
        },
        methods: {
            btn(){
                console.log(this.$refs.title);  // 真实DOM元素
                console.log(this.$refs.sch);    // School组件的实例对象(vc)
            }

        },

    }
</script>
